package com.example.demo.entity;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.Date;
import java.util.List;

public class User implements UserDetails {
    private Integer userid;

    private String name;

    private String sex;

    private String loginid;

    private String password;

    private Integer passwordfaultnum;

    private Date pwdlastmodifydate;

    private String islock;

    private Integer sort;

    private String effective;

    private String tel;

    private Integer createuser;

    private Date createtime;

    private Integer directorgid;

    private String destory;

    private Integer typeflag;

    //用户权限列表
    private List<GrantedAuthority> authorities;

    public Integer getUserid() {
        return userid;
    }

    public void setUserid(Integer userid) {
        this.userid = userid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex == null ? null : sex.trim();
    }

    public String getLoginid() {
        return loginid;
    }

    public void setLoginid(String loginid) {
        this.loginid = loginid == null ? null : loginid.trim();
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return authorities;
    }

    public String getPassword() {
        return password;
    }

    @Override
    public String getUsername() {
        return loginid;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return islock.equals("0")?true:false;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }

    public void setPassword(String password) {
        this.password = password == null ? null : password.trim();
    }

    public Integer getPasswordfaultnum() {
        return passwordfaultnum;
    }

    public void setPasswordfaultnum(Integer passwordfaultnum) {
        this.passwordfaultnum = passwordfaultnum;
    }

    public Date getPwdlastmodifydate() {
        return pwdlastmodifydate;
    }

    public void setPwdlastmodifydate(Date pwdlastmodifydate) {
        this.pwdlastmodifydate = pwdlastmodifydate;
    }

    public String getIslock() {
        return islock;
    }

    public void setIslock(String islock) {
        this.islock = islock == null ? null : islock.trim();
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public String getEffective() {
        return effective;
    }

    public void setEffective(String effective) {
        this.effective = effective == null ? null : effective.trim();
    }

    public String getTel() {
        return tel;
    }

    public void setTel(String tel) {
        this.tel = tel == null ? null : tel.trim();
    }

    public Integer getCreateuser() {
        return createuser;
    }

    public void setCreateuser(Integer createuser) {
        this.createuser = createuser;
    }

    public Date getCreatetime() {
        return createtime;
    }

    public void setCreatetime(Date createtime) {
        this.createtime = createtime;
    }

    public Integer getDirectorgid() {
        return directorgid;
    }

    public void setDirectorgid(Integer directorgid) {
        this.directorgid = directorgid;
    }

    public String getDestory() {
        return destory;
    }

    public void setDestory(String destory) {
        this.destory = destory == null ? null : destory.trim();
    }

    public Integer getTypeflag() {
        return typeflag;
    }

    public void setTypeflag(Integer typeflag) {
        this.typeflag = typeflag;
    }

    public void setAuthorities(List<GrantedAuthority> authorities) {
    }
}